<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/30
 * Time: 9:17
 * 最近售出
 */
require_once 'common.php';
$action = $_GET['action'];
if($action == ''){//页面
    require View::getView('index');
    View::Output();
}elseif ($action == 'ajaxpages'){
    $cons = "userid=" . $_SESSION['user_id'] . " AND is_api=0 AND is_status<>0 AND is_status<>4";
    $pages = $_POST['pages'] ? $_POST['pages'] : 1;
    $pagesize = 10;
    $offset = ($pages - 1) * 10;
    $lists = array();
    $data = WoodyApp::model('dlorders')->get_orders_list($pagesize, $offset, $cons);
    foreach ($data as $key => $row) {
        $channelname = $row['channelid'] == 99999 ? '组合支付' : $row['channelname'];
        $row['channelname'] = $channelname;
        $row['goodname'] = $row['goodname'] ? $row['goodname'] : '-';
        $row['success_money'] = number_format($row['success_money'],2,'.','');
        $row['income_money'] = number_format($row['income_money'],2,'.','');
        $lists[] = $row;
    }
    if($lists){
        $Err['code'] = 1;
        $Err['msg'] = $lists;
    }else{
        $Err['code'] = -1;
        $Err['msg'] = '暂无更多数据！';
    }
    echo json_encode($Err);
    exit;
}